package com.example.demo;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by IntelliJ IDEA.
 * User: zm
 * Date: 2023/4/24
 */
@Controller//控制器
@ResponseBody//返回的是数据
public class TestController {
    @RequestMapping("/hi")
    public String sayHi(String name){
        if(!StringUtils.hasLength(name)){
            name = "张三";
        }
        return "你好: " + name;
    }
}
